import React,{Component} from 'react'

export default class Demo09_ref_children2 extends Component {
  constructor(props){
    super(props);
    this.state={
      show:true
    }
  }
  handleClick(){
   // let show = this.state.show;
    this.setState({
      show:!this.state.show
    })
  }

  showDiv(){
    if(this.state.show){
      return (
          <div style={{width:'1rem',height:'1rem',background:'rgba(0,0,0,.8)',marginBottom:'0.4rem'}}></div>
      );
    }
  }

  render(){
    return (
        <div>
          <h1>test if shou</h1>
          {this.showDiv()}
          {/*{this.state.show?*/}
              {/*<div style={{width:'1rem',height:'1rem',background:'rgba(0,0,0,.8)',marginBottom:'0.4rem'}}></div>*/}
              {/*:null*/}
          {/*}*/}
          <button onClick={this.handleClick.bind(this)}>
            获取兄弟组件的inputval
          </button>
        </div>

    )
  }

}